package com.yk.platform.ui;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;

import com.yk.framework.entity.ICoreBaseInfo;
import com.yk.framework.gui.ctrl.YKTextField;
import com.yk.framework.gui.edit.DataBinding;
import com.yk.framework.gui.edit.YKEditUI;
import com.yk.platform.entity.GoodsEntity;

/**
 * 
 * @author lifetime
 * 
 */
public class GoodsEditPanel extends YKEditUI {
	private JLabel jLabel1;
	private YKTextField txtGoodsNumber;
	private JLabel jLabel2;
	private YKTextField txtGoodsName;
	private JLabel jLabel4;
	private YKTextField txtGoodsSize;
	private JLabel jLabel5;
	private YKTextField txtGoodsOldPrice;
	private YKTextField txtGoodsColor;
	private JLabel jLabel3;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new GoodsEditPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public GoodsEditPanel() {
		super();
		initGUI();
	}

	protected void registerDataBinding() {
		dataBinding.registerBinding(txtGoodsColor, "goodsColor", DataBinding.Binding_Text);
		dataBinding.registerBinding(txtGoodsName, "goodsName", DataBinding.Binding_Text);
		dataBinding.registerBinding(txtGoodsNumber, "goodsNumber", DataBinding.Binding_Text);
		dataBinding.registerBinding(txtGoodsOldPrice, "goodsOldPrice", DataBinding.Binding_Text);
		dataBinding.registerBinding(txtGoodsSize, "goodsSize", DataBinding.Binding_Text);
	}

	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(400, 330));
			this.setLayout(null);
			{
				jLabel1 = new JLabel();
				this.add(jLabel1);
				jLabel1.setText("\u5546\u54c1\u7f16\u7801");
				jLabel1.setBounds(29, 18, 69, 17);
			}
			{
				txtGoodsNumber = new YKTextField();
				this.add(txtGoodsNumber);
				txtGoodsNumber.setBounds(121, 15, 192, 24);
			}
			{
				jLabel2 = new JLabel();
				this.add(jLabel2);
				jLabel2.setText("\u5546\u54c1\u540d\u79f0");
				jLabel2.setBounds(29, 65, 84, 17);
			}
			{
				txtGoodsName = new YKTextField();
				this.add(txtGoodsName);
				txtGoodsName.setBounds(121, 62, 192, 24);
			}
			{
				jLabel3 = new JLabel();
				this.add(jLabel3);
				jLabel3.setText("\u5546\u54c1\u989c\u8272");
				jLabel3.setBounds(29, 111, 84, 17);
			}
			{
				txtGoodsColor = new YKTextField();
				this.add(txtGoodsColor);
				txtGoodsColor.setBounds(121, 104, 192, 24);
			}
			{
				jLabel4 = new JLabel();
				this.add(jLabel4);
				jLabel4.setText("\u5546\u54c1\u5c3a\u5bf8");
				jLabel4.setBounds(29, 156, 84, 17);
			}
			{
				txtGoodsSize = new YKTextField();
				this.add(txtGoodsSize);
				txtGoodsSize.setBounds(121, 153, 192, 24);
			}
			{
				jLabel5 = new JLabel();
				this.add(jLabel5);
				jLabel5.setText("\u5546\u54c1\u539f\u4ef7");
				jLabel5.setBounds(29, 201, 84, 17);
			}
			{
				txtGoodsOldPrice = new YKTextField();
				this.add(txtGoodsOldPrice);
				txtGoodsOldPrice.setBounds(121, 198, 192, 24);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	protected ICoreBaseInfo createNewData() {
		return new GoodsEntity();
	}

}
